import { AxiosRequestConfig } from 'axios'
import serverApiUtils from '@/core/utils/serverApiUtils'
import lodash from 'lodash'
import { R } from '@/components/axios/interface'
import http from '@/components/axios/http'
import IamApplicationResponse from '@/core/account/generated/types/model/response/IamApplicationResponse'
import accountAdminApiConfig from '@/core/account/generated/apiconfig/accountAdminApiConfig'

class AppApplicationServerApi {
	getByIds = (userToken: string, ids: string[]): Promise<R<IamApplicationResponse[]>> => {
		const config = lodash.merge(
			{
				params: { ids: ids },
				headers: serverApiUtils.addOnlyTokenHeader(userToken),
			} as AxiosRequestConfig,
			serverApiUtils.convertApiConfig(accountAdminApiConfig.iamApplication.list),
		)
		console.log(config)
		return http.post(config)
	}
}

const serverApi = new AppApplicationServerApi()
export default serverApi
